<template>
<div>
  <el-card class="table-container">
    <el-table :data="dataList" style="width: 100%">
      <!-- 序号 -->
      <el-table-column  type="index" width="50" :label="$t('common.col_index')">
      </el-table-column>
      <!-- 名称 -->
      <el-table-column prop="name" :label="$t('pages.carousel.name')">
      </el-table-column>
      <!-- 图片 -->
      <el-table-column prop="content" :label="$t('pages.carousel.image')">
        <template slot-scope="scope">
          <img style='width:60px;height:60px;' :src="scope.row.content" alt="">
        </template>
      </el-table-column>
      <!-- 上传人 -->
      <el-table-column prop="createUser" :label="$t('pages.carousel.upName')">
      </el-table-column>
      <!-- 描述 -->
      <el-table-column prop="description" :label="$t('pages.carousel.info')">
      </el-table-column>
      <!-- 上传时间 -->
      <el-table-column prop="createTime" :label="$t('pages.carousel.upTime')">
      </el-table-column>
      <!-- 停用时间 -->
      <el-table-column prop="updateTime" :label="$t('pages.carousel.stopTime')">
      </el-table-column>
      <!-- 操作 -->
      <el-table-column
        label-class-name="text-center"
        class-name="text-center action"
        prop="operate"
        :label="$t('common.operation')"
        width="190">
        <template slot-scope="scope">
          <!-- <a v-if="typeCar === 'region'" class="text-info" @click.prevent="releaseHandle(scope.row)" href="/">{{ $t('pages.carousel.replace') }}</a> -->
          <a class="text-warning" @click.prevent="editHandle(scope.row)" href="/">{{ $t('common.edit') }}</a>
          <a class="text-info" @click.prevent="startHandle(scope.row)" href="/">{{ $t('pages.carousel.start') }}</a>
          <a class="text-danger" @click.prevent="stopHandle(scope.row)" href="/">{{ $t('pages.carousel.stop') }}</a>
          <a class="text-danger" @click.prevent="delBtn(scope.row.id)" href="/">{{ $t('common.delete') }}</a>
        </template>
      </el-table-column>

    </el-table>
    <el-pagination
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 30, 50, 100]"
      :total="totalPage"
      :page-size="pageSizeList" layout="total, prev, pager, next, jumper" >
    </el-pagination>
  </el-card>
</div>
</template>

<script type="text/ecmascript-6">
  export default {
    props: {
      typeCar: {
        type: String,
        default: 'all'
      },
      dataList: {
        type: Array,
        default: () => {
          return []
        }
      },
      pageIndex: {
        type: Number,
        default: 1
      },
      pageSize: {
        type: Number,
        default: 10
      },
      totalPage: {
        type: Number,
        default: 100
      }
    },
    data () {
      return {
        currentPage: this.pageIndex,
        pageSizeList: this.pageSize
      }
    },
    created () {
    },
    mounted () {
    },
    methods: {
      /***总部区域****/
      editHandle(data) {
        //编辑
        this.$emit('editHandle',data)
      },

      /* 分页 */
      handleCurrentChange(page) {
        //当前页码
        this.currentPage = page
        this.$emit('current-change',page)
      },
      /***结束总部区域***/

      /* ***区域维护 */


      releaseHandle(data) {
        this.$emit('releaseHandle', data)
      },


      /* ***区域维护结束 */

       /*删除按钮*/
      delBtn(data) {
        //接口
        this.$emit('delete',data)
      },

      /* 启用按钮 */
      startHandle(data) {
        //接口
        this.$emit('start',data)
      },
      /* 启用按钮 */
      stopHandle(data) {
        //接口
        this.$emit('stop',data)
      },


    },
  }
</script>

<style scoped>

</style>
